<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Tổ chuyên môn';
$this->template->display('dsp_header.php');
$v_MA_DON_VI_filter        = $arr_filter['cbx_MA_DON_VI_filter'];
?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');

    echo $this->hidden('hdn_dsp_single_method','dsp_single_tochuyenmon');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_tochuyenmon');
    echo $this->hidden('hdn_update_method','update_tochuyenmon');
    echo $this->hidden('hdn_delete_method','delete_tochuyenmon');
    $v_row = 0;
    ?>
    <div id="div_filter">
        <label>Đơn vị</label>
        <select id="cbx_MA_DON_VI_filter"
                name="cbx_MA_DON_VI_filter"
                onchange="this.form.submit();"
                >
                  <?php while ($arr = $arr_all_donvi_filter->FetchRow()): ?>
                  <?php
                   $MA_DON_VI_CBX=$arr['MA_DON_VI'];
                   $TEN_DON_VI_CBX=$arr['TEN_DON_VI'];
                  ?>
                   <?php if($v_MA_DON_VI_filter == $MA_DON_VI_CBX):?>
                     <option value="<?php echo $MA_DON_VI_CBX; ?>" selected="selected"><?php echo $TEN_DON_VI_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_DON_VI_CBX; ?>" ><?php echo $TEN_DON_VI_CBX; ?></option>
                  <?php endif ?>
                <?php endwhile; ?>
        </select>
        <input class = 'button' type="button" name="btn_add_tochuyenmon" value="Thêm tổ chuyên môn" onclick="row_tochuyenmon_onclick_pop_win('0')"/>
    </div>
    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="78%" />
            <col width="6%" />
            <col width="8%" />
            <col width="8%" />
        </colgroup>
        <tr>
            <th>Tên tổ chuyên môn</th>
            <th>Thứ tự</th>
            <th>Trạng thái</th>
            <th>Thao tác</th>
        </tr>
         <?php while ($arr = $arr_all_TR_TO_CHUYEN_MON->FetchRow()): ?>
           <?php
               $ALL_TR=$arr['ALL_TR'];
               $TONG_SO_DONG=$arr['TONG_SO_DONG'];
               echo $arr['ALL_TR'];?>
           <?php endwhile; ?>
        <?php echo $this->add_empty_rows($TONG_SO_DONG, _CONST_DEFAULT_ROWS_PER_PAGE, 4);?>
    </table>

</form>
<script>
    
    function row_tochuyenmon_onclick_pop_win(matochuyenmon){
        var url = '<?php echo $this->get_controller_url();?>dsp_single_tochuyenmon/'  + matochuyenmon
            url += '/?&matochuyenmon=' + matochuyenmon + '&hdn_item_id=' + matochuyenmon + '&pop_win=1';
        showPopWin(url ,600,250, null);
    }
    function quick_delete_tochuyenmon(matochuyenmon)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  matochuyenmon;
            m = $("#controller").val() + 'delete_tochuyenmon'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }
</script>
<?php $this->template->display('dsp_footer.php');